home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / crtseg.exe / CRTSEG.PAS < prev    next >
Pascal/Delphi Source File  |  1992-07-24  |  2KB  |  56 lines

  1. Unit CrtSeg;
  2. {
  3.   CRTSEG.TPU - Written by Tom Donnelly and placed into the public domain.
  4.  
  5.                Allow the video segment address in CRT.TPU
  6.                to be overridden with a different address.
  7.                Particularly useful under DesqView, to make
  8.                Turbo Pascal programs more DesqView compliant.
  9.  
  10.   Example:     SetCrtSeg(Desqview_video_buffer);
  11.  
  12.   This unit has only been tested under Turbo Pascal 6.  It may or may not
  13.   work under different TP versions.  It is distributed "as is" without any
  14.   claims or warranties expressed or implied.  Use at your own risk.
  15.  
  16.   If anyone finds a problem with this code, I'd appreciate hearing about it.
  17.   Tom Donnelly - 73200,1323
  18.  
  19.   07/23/92 - Version 1.0 - Initial public-domain release.
  20. }
  21.  
  22. Interface
  23.  
  24. Uses
  25.    CRT;
  26.  
  27. Procedure SetCrtSeg(iSeg: Word);
  28.  
  29. Implementation
  30.  
  31. Const
  32.    CRTSEGOFFSET         = $5D3;  {Offset in CRT.TPU to CRT buff seg value}
  33.    OldCrtSeg            : Word
  34.                         = $B800;
  35.  
  36. Procedure SetCrtSeg;
  37. Var
  38.    CrtSegAddr           : ^Word;       {Pointer to CRT buffer segment literal}
  39.    CrtNoOps             : ^Byte;       {Pointer to area to no-op}
  40. Begin
  41.    CrtSegAddr := Ptr(Seg(AssignCrt),CRTSEGOFFSET);
  42.    CrtNoOps   := Ptr(Seg(AssignCrt),CRTSEGOFFSET+2);
  43.    If CrtSegAddr^<>OldCrtSeg Then
  44.    Begin
  45.       Writeln('CRTSEG.TPU: Could not find CRT segment address hook');
  46.       If ReadKey<>#0 Then;
  47.    End
  48.    Else
  49.    Begin
  50.       OldCrtSeg  :=CrtSegAddr^;
  51.       CrtSegAddr^:=iSeg;                   {Plug in new CRT buffer segment}
  52.       FillChar(CrtNoOps^,9,$90);           {No-op the remainder of the code}
  53.    End;
  54. End;
  55. End.
  56.